﻿using StoryTeller.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace StoryTeller.Infrastructure.DataAccess.Parser
{
    public static class StoryRatingParser
    {
        public static StoryRating ParseEntityToDomain(this EStoryRating entity)
        {
            StoryRating sr = new StoryRating();

            sr.LastUpdate = entity.LastUpdate;
            sr.CreationDate = entity.CreationDate;
            sr.User = entity.User.ParseEntityToDomain();
            sr.Story = entity.Story.ParseEntityToDomain();
            sr.Rate = entity.Rate;

            return sr;
        }

        public static EStoryRating ParseDomainToEntity(this StoryRating domain)
        {
            EStoryRating sr = new EStoryRating();

            sr.LastUpdate = domain.LastUpdate;
            sr.CreationDate = domain.CreationDate;
            sr.User = domain.User.ParseDomainToEntity();
            sr.Story = domain.Story.ParseDomainToEntity();
            sr.Rate = domain.Rate;

            return sr;
        }
    }
}
